package com.common.www.service.programme;


import org.springframework.boot.base.jpa.service.BaseLogicService;
import com.common.www.bean.entity.programme.TabulationExtracting;
import com.common.www.repository.programme.TabulationExtractingRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class TabulationExtractingService extends BaseLogicService<TabulationExtracting,Long> {
    @Autowired
    private TabulationExtractingRepository repository;
    @Override
    public TabulationExtractingRepository getRepository() {
        return repository;
    }


//    public void han(Project project,Integer jieDuan){
//        BigDecimal shuiLv;
//        BigDecimal hsBaoJia = BigDecimal.ZERO;
//        BigDecimal bhsBaoJia = BigDecimal.ZERO;;
//        BigDecimal hsxzBaoJia = BigDecimal.ZERO;;
//        for (InnerBidBaseTabulation tabulation : listArrange){
//            shuiLv = tabulation.getShuiJinFillIn();
//            hsBaoJia = hsBaoJia.add(tabulation.getTotalPriceOriginal());
//            hsxzBaoJia = hsxzBaoJia.add(tabulation.getTotalPrice());
//        }
//        bhsBaoJia = hsBaoJia.divide(shuiLv.add(1));
//        TabulationExtracting tabulationExtracting = getRepository().findByFlagAndProjectIdAndJieDuanAndInnerOuterType(1,projectId,jieDuan,1);
//        if (tabulationExtracting == null){
//            tabulationExtracting = new TabulationExtracting();
//            tabulationExtracting.setProject(project);
//            tabulationExtracting.setShuiLv(shuiLv);
//            tabulationExtracting.setHsBaoJia(hsBaoJia);
//            tabulationExtracting.setBhsBaoJia(bhsBaoJia);
//            tabulationExtracting.setHsxzBaoJia(hsxzBaoJia);
//            tabulationExtracting.setInnerOuterType(1);
//            tabulationExtracting.setJieDuan(jieDuan);
//        }else {
//            tabulationExtracting.setShuiLv(shuiLv);
//            tabulationExtracting.setHsBaoJia(hsBaoJia);
//            tabulationExtracting.setBhsBaoJia(bhsBaoJia);
//            tabulationExtracting.setHsxzBaoJia(hsxzBaoJia);
//        }
//        save(tabulationExtracting);
//    }



}
